

Ext.define('UDZ.controller.Ctr_Address_Change', {
    extend: 'Ext.app.Controller',

    config: {
        refs: {
            addressChangeview:{
                selector:'addressChange',
                xtype:'addressChange',
                autoCreate:true
            },
            AddressChangeBack:'#change_address_back',//返回收货地址管理

        },
        control:{
            AddressChangeBack:{
                tap:'func_AddressChangeBack'
            }

        },
        routes:{ //自己的路由
            'route_address_change/:addressID':'showAddressChange',
            // 'route/:AddressId':''
        }
    },
    showAddressChange:function (addressID){
       // Ext.Viewport.setActiveItem(this.getAddressChangeview());
        Ext.Viewport.animateActiveItem(this.getAddressChangeview(),{type:'slide',duration:500,direction:'left'});

        var addresschange = Ext.getStore('Store_Address');
        addresschange.load({
            callback: function (records, operation, success) {
                if (success) {

                    Ext.getCmp('xiaomaodiaoyu_001').setHtml(sessionStorage.getItem('admin'));

                    var tplAddressChange = new Ext.XTemplate(
                        '<tpl for=".">'+
                        '<div class="address_container" > ' +
                        '<div class="address_content"> ' +
                        '<div class="address_name"> ' +
                        '<span class="address_span_name">{UserName}</span> ' +
                        '<span class="address_span_Tel">{UserTel}</span> ' +
                        '</div> ' +
                        '<div class="address_detail">{address}</div> ' +
                        '</div> ' +
                        '<div class="address_righrt"><img src=" resources/images/right.png" alt=""></div>'+
                        '<div>'+
                        '</tpl>'
                    )
                    var changeAddressList = Ext.getCmp('change_address');
                    changeAddressList.setItemTpl(tplAddressChange);
                    changeAddressList.setStore(this);
                }
            }
        })

    },
    func_AddressChangeBack:function () {
        this.redirectTo('route_address_manger');
    }
});